package com.softeem.lianxi;

import java.util.ArrayList;

/**
 * @author xiyu
 * @version 1.0
 * @date 2025/3/21 11:06
 * @description
 */
public class Test {
    public static void main(String[] args) {
        Emp e1 = new Emp(1,"老一","干后勤的",5000.0,25,"后勤部");
        Emp e2 = new Emp(2,"老二","html",5200.0,24,"前端部");
        Emp e3 = new Emp(3,"老三","java",4582.0,26,"后端部");

        ArrayList<Emp> emps = new ArrayList<>();
        emps.add(e1);
        emps.add(e2);
        emps.add(e3);
        for (Emp emp : emps) {
            System.out.println(emp);
        }
        System.out.println("----------------------------");
        for (int i = 0; i < emps.size(); i++) {
            Double salary = emps.get(i).getSalary();
            if (salary>=5000&&salary<=7000){
                emps.get(i).setSalary(salary*1.2);
            }
            System.out.println(emps.get(i));
        }
        System.out.println("----------------------------");
        for (int i = 0; i < emps.size(); i++) {
            String dept = emps.get(i).getDept();
            if (dept.equals("后勤部")){
                emps.remove(i);
                i--;
            }
        }
        for (Emp emp : emps) {
            System.out.println(emp);
        }

    }
}
